<div id="information">
<br /><br />
<?php
$username = $_SESSION['username'];
	$sel_username = mysql_query('SELECT * FROM users WHERE username = "'.$username.'"');
	$row_u = mysql_fetch_assoc($sel_username);
	
	if($row_u['type'] == 2 || $row_u['type'] == 3) {
?>
		<div id='admin_add_cat'>
			<p>
				<a href='add_cat.php'>Добави нова категория към форума ..</a>
			</p>
		</div>
<?php
	}
?>
	<br />
	<?php
	if($_GET['moda']=="delete"){
	    $delete_f='UPDATE categories SET locked=1 WHERE id='.$_GET['id'].'';
		$results_delete_f=mysql_query($delete_f);
		
		echo '
		<script type="text/javascript">
		alert("Успешно заключване на категория!");
		</script>
		';
		echo '<meta http-equiv="refresh" content="0;url=forum.php">';
	} else {
	$sel_cat = 'SELECT * FROM categories WHERE locked=0 ORDER BY date DESC';
	$sel_cat_q = mysql_query($sel_cat);
			
	while($row_c = mysql_fetch_assoc($sel_cat_q)) {
	?>
	<div id='forum_DIV'>
		<div id='title'>
			<b><a href='see_cat.php?id=<?php echo $row_c['id']; ?>' style="margin-left: 10px; position: relative; top: 4px;"><?php echo $row_c['cat_title'];?></a></b>
		<?php
		if($_SESSION['username']=="admin"){
	      echo '<a href="forum.php?id='.$row_c['id'].'&amp;moda=delete" class="show">
	      <img src="../img/delete.png" width="15px" height="15px" alt="delete" style="position: relative; left: -15px; bottom: -6px;"/></a>';
	    }
		?>
		</div>
		
		<div id='body_title'>
				<?php echo $row_c['cat_descr'];?>
		</div>
		
		<div id='body_right_date'>
			<p>Добавена от <b><?php echo $row_c['who_added']; ?></b>
			на <b><?php echo date('Y-m-d', $row_c['date']);?></b></p>
		</div>
	</div>
	<br />
	<?php
	}
	}
	?>
	<br />
</div>